<template>
  <div class="section">
    <div class="home-container w-container">
      <!--顶部标题-->
      <div class="rf-content-narrow">
        <h2 class="dark center">
          Integrate foundation models and generative AI in your computer vision
          pipeline
        </h2>
        <div class="rf-subhead center white-shadow">
          Use models from OpenAI, Meta AI, and thousands of top open source
          repositories.
        </div>
      </div>
    </div>
    <div class="centered-container-rf-home w-container">
      <div class="cards-grid-container relative-home">
        <!--三张图片-->
        <div class="home-card-div">
          <!--通过鼠标移入移除来切换图片-->
          <div
            class="home-hover-img-mask"
            @mouseenter="showImg(1)"
            @mouseleave="hideImg"
          >
            <!--v-if判断isImgVisible值，是否显示图片-->
            <img
              v-if="isImgVisible !== 1"
              src="../assets/images/photo_1.webp"
              sizes="(max-width: 479px) 100vw, (max-width: 767px) 97vw, (max-width: 991px) 32vw, 31vw"
              alt="Embeddings chart"
              class="home-hover-img"
              style="opacity: 1"
            />
            <img
              v-else
              src="../assets/images/photo_2.webp"
              sizes="(max-width: 479px) 100vw, (max-width: 767px) 97vw, (max-width: 991px) 32vw, 31vw"
              alt="Embeddings chart"
              class="home-hover-img"
              style="opacity: 1"
            />
          </div>
          <!--图片上的小图片-->
          <div class="icon__bullet__container purple moved">
            <div class="icon__small white">
              <img src="../assets/images/放大镜.svg" alt="" />
            </div>
          </div>
          <!--下方文字-->
          <p class="row_subtext home-positioned white-shadow">
            Organize visual data with CLIP vector embeddings
          </p>
        </div>
        <div class="home-card-div">
          <div
            class="home-hover-img-mask"
            @mouseenter="showImg(2)"
            @mouseleave="hideImg"
          >
            <img
              v-if="isImgVisible !== 2"
              src="../assets/images/photo_3.webp"
              sizes="(max-width: 479px) 100vw, (max-width: 767px) 97vw, (max-width: 991px) 32vw, 31vw"
              alt="construction worker with protective gear surrounded by equipment"
              class="home-hover-img"
              style="opacity: 1"
            />
            <img
              v-else
              src="../assets/images/photo_4.webp"
              sizes="(max-width: 479px) 100vw, (max-width: 767px) 97vw, (max-width: 991px) 32vw, 31vw"
              alt="construction worker with protective gear surrounded by equipment"
              class="home-hover-img"
              style="opacity: 1"
            />
          </div>
          <div class="icon__bullet__container purple moved">
            <div class="icon__small white">
              <img src="../assets/images/星星.svg" alt="" />
            </div>
          </div>
          <p class="row_subtext home-positioned white-shadow">
            Automate labeling with zero-shot generalization using Segment
            Anything&nbsp;(SAM)
          </p>
        </div>
        <div class="home-card-div">
          <div
            class="home-hover-img-mask"
            @mouseenter="showImg(3)"
            @mouseleave="hideImg"
          >
            <img
              v-if="isImgVisible !== 3"
              src="../assets/images/photo_5.webp"
              sizes="(max-width: 479px) 100vw, (max-width: 767px) 97vw, (max-width: 991px) 32vw, 31vw"
              alt="decorative interior with wicker furniture and houseplants"
              class="home-hover-img"
              style="opacity: 1"
            />
            <img
              v-else
              src="../assets/images/photo_6.webp"
              sizes="(max-width: 479px) 100vw, (max-width: 767px) 97vw, (max-width: 991px) 32vw, 31vw"
              alt="decorative interior with wicker furniture and houseplants"
              class="home-hover-img"
              style="opacity: 1"
            />
          </div>
          <div class="icon__bullet__container purple moved">
            <div class="icon__small white">
              <img src="../assets/images/火箭.svg" alt="" />
            </div>
          </div>
          <p class="row_subtext home-positioned white-shadow">
            Deploy foundation models, like SAM and CLIP, via hosted API or at
            the edge
          </p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "SectionThree",
  data() {
    return {
      /*默认值为0，显示默认*/
      isImgVisible: 0,
    };
  },
  components: {},
  methods: {
    /*鼠标移入 将index值赋值给 isImgVisible 实现鼠标移入显示另一张图片*/
    showImg(index) {
      this.isImgVisible = index;
    },
    /*鼠标移除 isImgVisible 赋值为0 显示默认图片*/
    hideImg() {
      this.isImgVisible = 0;
    },
  },
  mounted() {},
};
</script>

<style lang="less" scoped>
.section {
  padding-top: 30px;
  padding-bottom: 30px;
  background-image: url("../assets/images/background.webp");
  background-size: 100% 58%;
  background-position: center 160px; /* 设置背景图片的初始位置为居中顶部 */
  background-repeat: no-repeat;
  .home-container {
    max-width: 1200px;
    /*顶部文字*/
    .rf-content-narrow {
      max-width: 800px;
      flex-direction: column;
      align-items: center;
      margin-left: auto;
      margin-right: auto;
      display: flex;
      .dark {
        color: #1f2937;
      }
      .center {
        text-align: center;
      }
      h2 {
        color: #111827;
        margin-top: 24px;
        margin-bottom: 16px;
        font-size: 40px;
        font-weight: 700;
        line-height: 1.2;
        position: static;
      }
      .rf-subhead,
      .center,
      .white-shadow {
        text-shadow: 0 1px 1px #fff;
      }
      .rf-subhead,
      .center {
        text-align: center;
      }
      .rf-subhead {
        text-align: left;
        margin-top: 0;
        margin-bottom: 20px;
        font-size: 18px;
        font-weight: 400;
        line-height: 2;
        color: #5d5959;
      }
    }
  }
  .w-container {
    max-width: 940px;
    margin-left: auto;
    margin-right: auto;
  }
  //图片文字
  .centered-container-rf-home {
    max-width: 1200px;
    text-align: center;
    flex: 1;
    padding-top: 30px;
    padding-bottom: 0;
    position: relative;
    .cards-grid-container {
      grid-column-gap: 40px;
      grid-row-gap: 40px;
      text-align: left;
      grid-template-rows: auto;
      grid-template-columns: 1fr 1fr 1fr;
      grid-auto-columns: 1fr;
      margin-bottom: 40px;
      display: grid;
      /*卡片*/
      .home-card-div {
        /*图片*/
        .home-hover-img-mask {
          width: 100%;
          border-radius: 8px;
          margin-bottom: 20px;
          padding-top: 60%;
          position: relative;
          overflow: hidden;
          .home-hover-img {
            z-index: 10;
            width: 100%;
            height: 100%;
            max-width: none;
            object-fit: cover;
            object-position: 50% 50%;
            border-radius: 8px;
            position: absolute;
            top: 0%;
            bottom: 0%;
            left: 0%;
            right: 0%;
            img {
              max-width: 100%;
              vertical-align: middle;
              display: inline-block;
            }
          }
        }
        .home-hover-img-mask:hover {
          box-shadow: #999999 5px 5px 13px;
          transition: box-shadow 0.5s;
        }
        .icon__bullet__container.purple.moved {
          z-index: 12;
          position: relative;
          top: -50px;
          bottom: auto;
          left: 20px;
          right: auto;
        }
        .icon__bullet__container.purple {
          background-color: #6706ce;
        }
        .purple {
          color: #6706ce;
        }
        .icon__bullet__container {
          width: 48px;
          height: 48px;
          background-color: #00ffce;
          border-radius: 8px;
          flex: none;
          margin-bottom: 10px;
          margin-right: 24px;
          .icon__small.white {
            color: #fff;
            line-height: 48px;
            text-align: center;
            img {
              width: 70%;
              height: 70%;
            }
          }
        }
        /*图片下方文字效果*/
        .row_subtext,
        .home-positioned {
          margin-top: -50px;
          padding-left: 20px;
        }
        .row_subtext {
          font-size: 21px;
          line-height: 24px;
        }
        p {
          margin-bottom: 16px;
          line-height: 1.6;
          color: #5d5959;
        }
      }
    }
  }
}
</style>
